<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        img {
            height: 300px;
        }
    </style>
</head>

<body>
    <img src="https://t7.baidu.com/it/u=1732966997,2981886582&fm=193&f=GIF" alt="">
    <script>
        let img = document.querySelector('img');
        let rect = img.getBoundingClientRect() // 获取元素的几何属性
        console.log(rect);
    </script>
</body>

</html>